22 template <class T
> string
toStr(const T
&x
)
23 { stringstream s
; s
<< x
; return s
.str(); }
24 template <class T
> int toInt(const T
&x
)
25 { stringstream s
; s
<< x
; int r
; s
>> r
; return r
; }
27 #define For(i, a, b) for (int i=(a); i<(b); ++i)
28 #define foreach(x, v) for (typeof (v).begin() x = (v).begin(); \
30 #define D(x) cout << #x " = " << (x) << endl
32 const double EPS
= 1e-9;
33 int cmp(double x
, double y
= 0, double tol
= EPS
){
34 return( x
<= y
+ tol
) ? (x
+ tol
< y
) ? -1 : 0 : 1;